//
//  CellTableViewForZhuanTi.m
//  
//
//  Created by dllo on 16/1/26.
//
//

#import "CellTableViewForZhuanTi.h"
#import "PCH.pch"
#import "ModelOfZhuanTi.h"
#import <UIImageView+WebCache.h>


@interface CellTableViewForZhuanTi ()

@property (nonatomic, retain)UIImageView *imageViewForBack;
@property (nonatomic, retain)UILabel *labelForName;
@property (nonatomic, retain)UILabel *labelForTitle;

@end

@implementation CellTableViewForZhuanTi

- (void)dealloc {
    [_labelForTitle release];
    [_labelForName release];
    [_imageViewForBack release];
    [super dealloc];
}

#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.imageViewForBack = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewForBack];
        [_imageViewForBack release];
        
        self.labelForName = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelForName];
        [_labelForName release];
        self.labelForName.textColor = [UIColor whiteColor];
        self.labelForName.font = [UIFont systemFontOfSize:25];
        
        self.labelForTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelForTitle];
        [_labelForTitle release];
        self.labelForTitle.textColor = [UIColor whiteColor];
        
    }
    
    return self;
    
}

/** 布局子视图 */
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViewForBack.frame = CGRectMake(4, 4, scWIDTH - 8, scHEIGHT - 8);
    self.labelForName.frame = CGRectMake(10, scHEIGHT - 80, WIDTH - 20, 40);
    self.labelForTitle.frame = CGRectMake(10, scHEIGHT - 43, WIDTH - 20, 35);
    
}

/** 赋值 */
- (void)passModel:(ModelOfZhuanTi *)model {
    
    [self.imageViewForBack sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    self.labelForName.text = model.name;
    
    self.labelForTitle.text = model.title;
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
